package com.biz.primus.management.adv.feign;

import com.biz.primus.base.vo.PageVo;
import com.biz.primus.common.vo.SpringPageVO;
import com.biz.primus.management.adv.degraded.DegradedAdvFeignClient;
import com.biz.primus.model.adv.enums.AdUsePlace;
import com.biz.primus.model.adv.enums.UseType;
import com.biz.primus.model.adv.vo.AdPositionVo;
import com.biz.primus.model.adv.vo.AdvertisementQueryVo;
import org.springframework.cloud.netflix.feign.FeignClient;

import com.biz.primus.model.adv.vo.AdvertisementVo;
import org.springframework.web.bind.annotation.*;

import java.math.BigDecimal;
import java.util.List;

/**
 * @author jun.liu
 * @date 2017/9/19
 */
@FeignClient(qualifier = "advFeignClient", name = "service-adv", fallback = DegradedAdvFeignClient.class)
public interface AdvFeignClient {

    @GetMapping("soa/advService/queryAdByUseType")
    List<AdPositionVo> queryAdByUseType(@RequestParam("utype") UseType utype);

    @PostMapping("soa/advService/addOrUpdateAdInfo")
    void addOrUpdateAdInfo(@RequestBody AdvertisementVo advo);

    @PostMapping("soa/advService/addOrUpdateAdPositionInfo")
    void addOrUpdateAdPositionInfo(@RequestBody AdPositionVo input);

    @GetMapping("soa/advService/deleteAdById")
    void deleteAdById(@RequestParam("id") long id);

    @GetMapping("soa/advService/deleteAdPositionById")
    void deleteAdPositionById(@RequestParam("id") long id);

    @GetMapping("soa/advService/getAllAds")
    List<AdvertisementVo> getAllAds();

    @GetMapping("soa/advService/getAdsByPositionId")
    List<AdvertisementVo> getAdsByPositionId(@RequestParam("positionId") long positionId);

    @GetMapping("soa/advService/getAdPositions")
    List<AdPositionVo> getAdPositions();

    @GetMapping("soa/advService/getAdPositionById")
    AdPositionVo getAdPositionById(@RequestParam("positionId") long positionId);

    @GetMapping("soa/advService/getAdById")
    AdvertisementVo getAdById(@RequestParam("adId") long adId);

    @PostMapping("soa/advService/getAdsByParams")
    SpringPageVO<AdvertisementVo> getAdsByParams(@RequestBody AdvertisementQueryVo queryVo);

    @PostMapping("soa/advService/getAllAdPositions")
    SpringPageVO<AdPositionVo> getAllAdPositions(@RequestBody PageVo vo);

    @GetMapping("soa/advService/findAdByProvinceId")
    AdPositionVo findAdByProvinceId(
            @RequestParam("latitude") BigDecimal latitude,
            @RequestParam("longitude") BigDecimal longitude,
            @RequestParam("adUsePlace") AdUsePlace adUsePlace);

    @GetMapping("soa/advService/getAdpositionCountry")
    AdPositionVo getAdpositionCountry(@RequestParam("adUsePlace") AdUsePlace adUsePlace);


    @GetMapping("soa/advService/findAdPositionByUsePlace")
    boolean findAdPositionByUsePlace(@RequestParam("adUsePlace") AdUsePlace adUsePlace);

}
